package com.py.credit.utils;

import java.text.DecimalFormat;
import java.text.NumberFormat;

import org.springframework.beans.factory.annotation.Autowired;

import com.py.credit.common.rest.RestServiceResult;
import com.py.credit.constant.ApiPath;
import com.py.credit.entity.DictEntity;
import com.py.credit.service.RemoteBaseService;

public class PercentUtil {
	public static String getPercent(int x,int total){  
		   String result="";//接受百分比的值  
		  // float a=
		   NumberFormat numberFormat = NumberFormat.getInstance();
			numberFormat.setMaximumFractionDigits(2);
			if(x==0||total==0) {
				result = "0%";
			}else {
				result = numberFormat.format(((float) x / (float) total) * 100)+"%";
			}
			return result;  
		}  

}
